package com.tressatisfiability.server;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.tressatisfiability.client.Service;
import com.tressatisfiability.shared.Formula;

@SuppressWarnings("serial")
public class ServiceImpl extends RemoteServiceServlet implements Service {

	private Formula formula = null;

	@Override
	public Formula solve3Sat(String q) {
		Formula retorno = new Formula(q);
		retorno.solve();
		formula = retorno;
		return retorno;
	}

	@Override
	public Formula retry() {
		if (formula == null) {
			formula.solve();
		}
		return formula;
	}

}
